package edu.zut.cs.software.example.group.dao;

import java.util.List;


import org.apache.ibatis.annotations.Param;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import edu.zut.cs.software.example.dao.GenericDao;
import edu.zut.cs.software.example.group.domain.Group;

/**
 * 
 * @author super
 *
 */
@Repository
public interface GroupDao extends GenericDao<Group,Long> {
	/**
	 * 对群组进行全部查找
	 */
	@Query(value = " SELECT * FROM T_GROUP", nativeQuery = true)
    public List<Group> getGroups();
	
	/**
	 * 按照前台传入的群组名称进行模糊查找
	 * @param name
	 */
	@Query(value = "  SELECT * FROM T_GROUP WHERE `name` LIKE CONCAT('%',?1,'%')", nativeQuery = true)
	public List<Group> searchByName(@Param("name")String name);
	
	/**
	 * 
	 * @return
	 */
	public Group findByName(String name);

}
